package com.hspjava.Arrays_;

import com.sun.org.apache.xml.internal.security.algorithms.implementations.IntegrityHmac;

import java.util.Arrays;

public class ArraysMethod02 {
    public static void main(String[] args) {
        Integer [] arr = {3, 5, 6, 7};
        //如果有返回下标。没有就返回应该在的位置+1取负数
        int index = Arrays.binarySearch(arr, 4);
        System.out.println(index);

        //超出了原数组范围， 会加上 null
        //拷贝长度等于0，拷贝空， 小于0抛出异常
        Integer[] newArr = Arrays.copyOf(arr, 0);
        System.out.println("===拷贝执行完毕后===");
        System.out.println(Arrays.toString(newArr));

        //ill 数组元素填充
        Integer[] num  = new Integer[] {1, 2, 5};
        Arrays.fill(num , 99);

        System.out.println("===填充后===");
        System.out.println(Arrays.toString(num));

        Integer [] arr2 = {3, 5, 6, 7};

        boolean flag = Arrays.equals(arr, arr2);
        System.out.println(flag);



    }
}
